#include <REGX52.H>
#include <intrins.h>

void Delay1ms(unsigned int xms)	//@12.000MHz
{
	while (xms)
	{
		unsigned char data i, j;
		i = 2;
		j = 239;
		do
		{
			while (--j);
		} while (--i);
		xms--;
	}
}

void main()
{
	int xms=500;
	while(1)
	{
		if (xms<0)
		{
			P2=0x00;
			Delay1ms(500);
			break;
		}
		P2=0xFE;
		Delay1ms(xms-100);
		P2=0xFD;
		Delay1ms(xms-100);
		P2=0xFB;
		Delay1ms(xms-290);
		P2=0xF7;
		Delay1ms(190);
		P2=0xEF;
		Delay1ms(xms+200);
		P2=0xDF;
		Delay1ms(50);
		P2=0xBF;
		Delay1ms(xms);
		P2=0x7F;
		Delay1ms(1);
		xms-=900;
	}
}